<html>
<head><meta charset="utf-8"><title>why is x.py necessary? · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html">why is x.py necessary?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="221141437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141437">(Dec 29 2020 at 15:23)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/131828-t-compiler/topic/the.20rustc-dev-guide.20is.20confusing/near/221141303">said</a>:</p>
<blockquote>
<p>I think the main issue we run into is that people <em>really</em> want to have one code snippet they can copy paste, and we don't have one to give them</p>
</blockquote>
<p>That's why <code>cargo</code> should work.</p>



<a name="221141488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141488">(Dec 29 2020 at 15:24)</a>:</h4>
<p><span class="user-mention silent" data-user-id="203546">Laurențiu Nicola</span> <a href="#narrow/stream/131828-t-compiler/topic/the.20rustc-dev-guide.20is.20confusing/near/221141292">said</a>:</p>
<blockquote>
<p>Which same sentence is that? I'm looking at <a href="https://rustc-dev-guide.rust-lang.org/building/suggested.html#configuring-rust-analyzer-for-rustc">https://rustc-dev-guide.rust-lang.org/building/suggested.html#configuring-rust-analyzer-for-rustc</a></p>
</blockquote>
<p>ah ok - that really does want to use rustfmt directly so you can format a single file at a time</p>



<a name="221141497"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141497" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141497">(Dec 29 2020 at 15:24)</a>:</h4>
<p><span class="user-mention silent" data-user-id="203546">Laurențiu Nicola</span> <a href="#narrow/stream/131828-t-compiler/topic/the.20rustc-dev-guide.20is.20confusing/near/221141437">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/131828-t-compiler/topic/the.20rustc-dev-guide.20is.20confusing/near/221141303">said</a>:</p>
<blockquote>
<p>I think the main issue we run into is that people <em>really</em> want to have one code snippet they can copy paste, and we don't have one to give them</p>
</blockquote>
<p>That's why <code>cargo</code> should work.</p>
</blockquote>
<p>no no this is my point</p>



<a name="221141506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141506">(Dec 29 2020 at 15:24)</a>:</h4>
<p>cargo is <em>fundamentally insufficient for building the compiler</em></p>



<a name="221141512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141512">(Dec 29 2020 at 15:24)</a>:</h4>
<p>it doesn't have any notion of multiple targets</p>



<a name="221141515"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141515" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141515">(Dec 29 2020 at 15:24)</a>:</h4>
<p>or stopping and resuming halfway through a build</p>



<a name="221141534"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141534" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141534">(Dec 29 2020 at 15:25)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/131828-t-compiler/topic/the.20rustc-dev-guide.20is.20confusing/near/221141515">said</a>:</p>
<blockquote>
<p>or stopping and resuming halfway through a build</p>
</blockquote>
<p>I always stop builds with Ctrl-C and resume them with <code>cargo build</code> or <code>cargo check</code>, what do you mean?</p>



<a name="221141549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141549">(Dec 29 2020 at 15:25)</a>:</h4>
<p>if you want to build the standard library, that requires about 1/10th of the time of a full <code>x.py build --stage 2</code></p>



<a name="221141552"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141552" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141552">(Dec 29 2020 at 15:25)</a>:</h4>
<p>how would you know when to stop?</p>



<a name="221141620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141620">(Dec 29 2020 at 15:26)</a>:</h4>
<p>the whole point of x.py is there are <em>multiple</em> targets it makes sense to build</p>



<a name="221141624"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141624" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141624">(Dec 29 2020 at 15:26)</a>:</h4>
<p>and each of them are complete in and of themselves</p>



<a name="221141626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141626">(Dec 29 2020 at 15:26)</a>:</h4>
<p>If <code>std</code> was in a different repo, I could clone only that. Or <code>cargo build -p libstd</code> might work. Of course they don't work now, but they <em>might</em> be made to work.</p>



<a name="221141660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141660">(Dec 29 2020 at 15:27)</a>:</h4>
<p>yeah, I would like for <code>cargo build -p libstd</code> to work - it sort of does today if you hack it enough</p>
<div class="codehilite"><pre><span></span><code>$ cd library/test
$ cargo +nightly build
</code></pre></div>



<a name="221141669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141669">(Dec 29 2020 at 15:27)</a>:</h4>
<p>but it will never understand stages</p>



<a name="221141677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141677">(Dec 29 2020 at 15:27)</a>:</h4>
<p>stages are where you use the output of one cargo invocation as the input compiler for another</p>



<a name="221141737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141737">(Dec 29 2020 at 15:28)</a>:</h4>
<p>I suggest reading through <a href="https://rustc-dev-guide.rust-lang.org/building/bootstrapping.html">https://rustc-dev-guide.rust-lang.org/building/bootstrapping.html</a></p>



<a name="221141754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141754">(Dec 29 2020 at 15:29)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/131828-t-compiler/topic/the.20rustc-dev-guide.20is.20confusing/near/221141669">said</a>:</p>
<blockquote>
<p>but it will never understand stages</p>
</blockquote>
<p>Neither will I <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span>. I know what stages are, but they've always seemed misnamed in <code>rustc</code>. I think there's an open issue for that.</p>



<a name="221141763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141763">(Dec 29 2020 at 15:29)</a>:</h4>
<p><a href="https://rustc-dev-guide.rust-lang.org/building/bootstrapping.html#understanding-stages-of-bootstrap">https://rustc-dev-guide.rust-lang.org/building/bootstrapping.html#understanding-stages-of-bootstrap</a></p>



<a name="221141860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141860">(Dec 29 2020 at 15:30)</a>:</h4>
<p>but yeah I have this discussion with basically every new contributor - they want <code>cargo build</code> to just work and I have to explain that x.py does more work than cargo could</p>



<a name="221141888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141888">(Dec 29 2020 at 15:30)</a>:</h4>
<p>I think it's feasible for <code>cargo build</code> to work on libstd with enough hacks, but not on anything else</p>



<a name="221141892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141892">(Dec 29 2020 at 15:30)</a>:</h4>
<p>Ideally, the compiler and <code>std</code> could be compiled with a beta or stable toolchain. <code>x.py</code> could still be used for CI for more advanced workflows, but testing <code>std</code> changes locally shouldn't be one.</p>



<a name="221141935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141935">(Dec 29 2020 at 15:31)</a>:</h4>
<p>Same for <code>rustfmt</code>. I understand that the compiler might be using new or unstable syntax today, but in the long run, a stable <code>rustfmt</code> can be enough.</p>



<a name="221141963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141963">(Dec 29 2020 at 15:32)</a>:</h4>
<p>please see <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/MCP.3A.20move.20compiler.2F.20crates.20to.20stable.20Rust.20compiler-team.23358">https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/MCP.3A.20move.20compiler.2F.20crates.20to.20stable.20Rust.20compiler-team.23358</a>, <a href="https://zulip-archive.rust-lang.org/131828tcompiler/38874Buildingrustcwithbetalibstd.html">https://zulip-archive.rust-lang.org/131828tcompiler/38874Buildingrustcwithbetalibstd.html</a> - this has been discussed a lot</p>



<a name="221141982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221141982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221141982">(Dec 29 2020 at 15:32)</a>:</h4>
<p>(a <em>lot</em>)</p>



<a name="221142282"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221142282" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221142282">(Dec 29 2020 at 15:37)</a>:</h4>
<p>and I still recommend reading the bootstrapping chapter</p>



<a name="221142292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221142292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221142292">(Dec 29 2020 at 15:37)</a>:</h4>
<p><a href="https://fs.blog/2020/03/chestertons-fence/">https://fs.blog/2020/03/chestertons-fence/</a></p>



<a name="221142609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221142609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221142609">(Dec 29 2020 at 15:42)</a>:</h4>
<p>I think I need to stop having these discussions before people read the bootstrapping chapter, it's bad for my health <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="221142758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221142758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221142758">(Dec 29 2020 at 15:44)</a>:</h4>
<p>Just to be clear, I've read the bootstrapping chapter (at some point, maybe it has changed), but it still seems to me that things could be simpler.</p>



<a name="221142948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221142948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221142948">(Dec 29 2020 at 15:47)</a>:</h4>
<p>It changed a lot in the past 3 months or so, I made a lot of changes</p>



<a name="221143035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221143035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221143035">(Dec 29 2020 at 15:48)</a>:</h4>
<p>I agree libstd specifically could be a lot simpler, but I really don't think the compiler could be</p>



<a name="221143112"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221143112" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221143112">(Dec 29 2020 at 15:49)</a>:</h4>
<p><span class="user-mention silent" data-user-id="203546">Laurențiu Nicola</span> <a href="#narrow/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F/near/221141626">said</a>:</p>
<blockquote>
<p>If <code>std</code> was in a different repo, I could clone only that. Or <code>cargo build -p libstd</code> might work. Of course they don't work now, but they <em>might</em> be made to work.</p>
</blockquote>
<p>if I could get <code>cargo build</code> working in library/std, I wonder if we could make it a subtree</p>



<a name="221143139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221143139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221143139">(Dec 29 2020 at 15:50)</a>:</h4>
<p>the main issue is that the compiler and standard library are one big workspace right now</p>



<a name="221143184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221143184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221143184">(Dec 29 2020 at 15:50)</a>:</h4>
<p>and 'nested workspaces' are mostly still a pipe dream</p>



<a name="221145960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221145960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221145960">(Dec 29 2020 at 16:27)</a>:</h4>
<p><span class="user-mention" data-user-id="203546">@Laurențiu Nicola</span> <a href="https://github.com/rust-lang/compiler-team/issues/394">https://github.com/rust-lang/compiler-team/issues/394</a></p>



<a name="221146406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221146406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221146406">(Dec 29 2020 at 16:32)</a>:</h4>
<blockquote>
<p>Split apart compiler/ and library/ so they no longer use the same global Cargo.lock and Cargo.toml.</p>
</blockquote>
<p>I recall it was a bit complicated, but this might even help <code>rust-analyzer</code></p>



<a name="221146453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221146453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221146453">(Dec 29 2020 at 16:33)</a>:</h4>
<p>right, there's a lot of discussion on <a href="https://github.com/rust-lang/rust/pull/76533">https://github.com/rust-lang/rust/pull/76533</a></p>



<a name="221146467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221146467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221146467">(Dec 29 2020 at 16:33)</a>:</h4>
<p>let's move to <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Make.20it.20easier.20to.20build.20the.20standard.20libr.E2.80.A6.20compiler-team.23394">https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Make.20it.20easier.20to.20build.20the.20standard.20libr.E2.80.A6.20compiler-team.23394</a> though</p>



<a name="221172319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221172319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221172319">(Dec 29 2020 at 22:12)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> FWIW, I'd love to extend Cargo to the point where it <em>could</em> be sufficient to build the Rust compiler, and other things with similar requirements.</p>



<a name="221172331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221172331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221172331">(Dec 29 2020 at 22:12)</a>:</h4>
<p>Artifact dependencies could help with part of that.</p>



<a name="221172357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221172357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221172357">(Dec 29 2020 at 22:13)</a>:</h4>
<p>Even the multi-phase build is something that's not wildly different from being able to express a crate dependency on a specific toolchain.</p>



<a name="221172370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221172370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221172370">(Dec 29 2020 at 22:13)</a>:</h4>
<p>I think, in general, the kinds of changes to Cargo that would be necessary to make it sufficient for building rustc are changes that would help for other users of Cargo as well.</p>



<a name="221173180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221173180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221173180">(Dec 29 2020 at 22:25)</a>:</h4>
<p><span class="user-mention silent" data-user-id="239881">Josh Triplett</span> <a href="#narrow/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F/near/221172319">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> FWIW, I'd love to extend Cargo to the point where it <em>could</em> be sufficient to build the Rust compiler, and other things with similar requirements.</p>
</blockquote>
<p>I'm really surprised to hear you say that <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span> x.py does a <em>lot</em> more than cargo.</p>
<blockquote>
<p>Even the multi-phase build is something that's not wildly different from being able to express a crate dependency on a specific toolchain.</p>
</blockquote>
<p>I see it as very different actually - this isn't just one crate depending on binary artifacts from another, this is the <em>same</em> crate being its <em>own</em> dependency</p>



<a name="221173190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221173190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221173190">(Dec 29 2020 at 22:26)</a>:</h4>
<p>since you need to build <code>rustc_middle</code> with the beta compiler in order to build rustc_middle with stage one</p>



<a name="221173234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221173234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221173234">(Dec 29 2020 at 22:26)</a>:</h4>
<p>and for that reason I don't see this being generally applicable</p>



<a name="221173281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221173281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221173281">(Dec 29 2020 at 22:27)</a>:</h4>
<p>eh, that part could be worked around with facade crates or something. but I agree we're a long way off.</p>



<a name="221174138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221174138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221174138">(Dec 29 2020 at 22:43)</a>:</h4>
<p>x.py also handles things like --keep-stage that deliberately prevent cache invalidation to speed up builds.</p>



<a name="221256007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221256007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221256007">(Dec 30 2020 at 23:37)</a>:</h4>
<p>I think there's an important part that it depends greatly how complicated a change one is making whether x.py is a problem.  I've been experimenting with a different <code>?</code> trait+desugar lately, and needing to use x.py instead of cargo for that is not an issue at all -- I'd have to look up all the magic incantations for cargo just the same as I need to for x.py, since the only way to be productive with that is to be very careful about stages, something I never need to care about in any other cargo situation.  I'm happy to <code>x.py test --stage 1 --keep-stage 0 src/test/ui</code> for that -- it's better than running cargo in three places in the right order.</p>



<a name="221256886"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221256886" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221256886">(Dec 30 2020 at 23:54)</a>:</h4>
<p>(btw --keep-stage 0 looks wrong there - do you mean <code>--keep-stage-std 1</code> maybe?)</p>



<a name="221337431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221337431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221337431">(Jan 01 2021 at 05:51)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F/near/221256886">said</a>:</p>
<blockquote>
<p>(btw --keep-stage 0 looks wrong there - do you mean <code>--keep-stage-std 1</code> maybe?)</p>
</blockquote>
<p>I don't think so -- I wanted to pick up changes to the compiler and std, but not rebuild the bootstrap version of std (since that forces the whole compiler to rebuild).</p>



<a name="221337546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221337546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221337546">(Jan 01 2021 at 05:55)</a>:</h4>
<p>ah ok, you're modifying <em>both</em> the compiler and the standard library</p>



<a name="221337549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221337549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221337549">(Jan 01 2021 at 05:55)</a>:</h4>
<p>I think you want --keep-stage-std 0 then, otherwise it will use a cached version of the compiler</p>



<a name="221399590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221399590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221399590">(Jan 02 2021 at 13:12)</a>:</h4>
<p>Yeah, "one snippet" can't work if alone for the reason that different snippets are needed depending on whether</p>
<ul>
<li>you just change the stdlib</li>
<li>you just change the compiler</li>
<li>you change both of them in a way that stdlib should use the enw compiler features (so you need to interact with bootstrapping)</li>
<li>probably more?</li>
</ul>



<a name="221468688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221468688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nadrieril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221468688">(Jan 03 2021 at 20:13)</a>:</h4>
<p>I've just discovered the discussion on std aware cargo (<a href="https://github.com/rust-lang/wg-cargo-std-aware/">https://github.com/rust-lang/wg-cargo-std-aware/</a>). I don't follow everything, could that help make bootstrap less special?</p>



<a name="221468950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221468950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221468950">(Jan 03 2021 at 20:18)</a>:</h4>
<p>It could help for stage1 builds, maybe</p>



<a name="221468951"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221468951" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221468951">(Jan 03 2021 at 20:18)</a>:</h4>
<p>I don't think it could help for stage 2</p>



<a name="221468960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/221468960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#221468960">(Jan 03 2021 at 20:18)</a>:</h4>
<p>within a stage perhaps but not between stages most likely.</p>



<a name="222471335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/why%20is%20x.py%20necessary%3F/near/222471335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/why.20is.20x.2Epy.20necessary.3F.html#222471335">(Jan 12 2021 at 18:07)</a>:</h4>
<p>another example of things x.py makes a lot easier than using cargo directly: <a href="https://github.com/rust-lang/rust/issues/46955#issuecomment-753264720">https://github.com/rust-lang/rust/issues/46955#issuecomment-753264720</a>. If you look at the linked PR, adding it in rustbuild is like 10 lines of code.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>